namespace SS.WPF.Framework.Preference
{
    using System.Collections.Generic;

    /// <summary>
    /// The delegate that is used to mark that preference key have been stored
    /// </summary>
    /// <param name="key"></param>
    /// <param name="newValue"></param>
    public delegate void PreferenceChangedHandler(string key, object newValue);

    /// <summary>
    /// The service that is used as controller for storing keys
    /// <para>
    /// It uses PreferenceStore as worker to store keys
    /// </para>
    /// </summary>
    public interface IPreferenceService 
    {
        /// <summary>
        /// The path that keys have been stored in 
        /// </summary>
        string PreferenceStorePath { get; }

        /// <summary>
        /// Event that is used to mark that at least a key has been stored
        /// </summary>
        event PreferenceChangedHandler PreferenceChanged;

        /// <summary>
        /// Invoke that key has been stored
        /// </summary>
        /// <param name="key"></param>
        /// <param name="newValue"></param>
        void InvokePreferenceChanged(string key, object newValue);

        /// <summary>
        /// Create new instance of PreferenceStore
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        IPreferenceStore GetPreferenceStore(string key);
    }
}